require('../db')
const addressesService = require('../service/addressesService')
const usersService = require('../service/usersService')
//增加
async function addAddresses() {
    console.log(await addressesService.insert({
        name: "王五", // 收件人姓名
        phone: "1321645113215", // 收件电话
        site: "王八村一号", // 收件地址
        userId: "60c1a93168c18443bfe2b032", // 用户 id
        tag: ["家"], // 标签
        isDefault: false // 是否默认地址
    }));
}
// addAddresses();
//修改
async function upAddresses() {
    console.log(await addressesService.update("60cabe3e673b5753c8af7813",{
        name: "张恒恒", // 收件人姓名
        phone: "1321645113215", // 收件电话
        site: "王八村二号", // 收件地址
        userId: "60caaaf53c0a174278f316ca", // 用户 id
        tag: ["家"], // 标签
        isDefault: false // 是否默认地址
    }));
}
// upAddresses();
//查询
async function findAddresses() {
    console.log(await addressesService.findAll());
}
// findAddresses();

//删除
async function deAddresses() {
    console.log(await addressesService.delete("60cabe3e673b5753c8af7813"));
}
// deAddresses()

//查询
async function findByuserAddresses() {
    console.log(await addressesService.findByuser({userId:'60c1a93168c18443bfe2b032'}));
}
findByuserAddresses();